﻿namespace FietsenManagementJB
{
    using System.Linq;
    using System.Windows.Forms;

    partial class Overview : Form
    {
        public Overview()
        {
            InitializeComponent();
        }

        public void fillComponents(BikeController parentFormController)
        {
            totalBuyTextBox.Text = parentFormController.Bikes.Sum(x => x.BuyPrice).ToString("C");
            totalSellTextBox.Text = parentFormController.Bikes.Sum(x => x.SellPrice).ToString("C");
            totalBalanceTextBox.Text = parentFormController.Bikes.Sum(x => x.Balance).ToString("C");
            var tmp = parentFormController.Bikes.Where(x => x.Sold == true);
            avarageTextBox.Text = tmp.Average(x => x.Balance).ToString("C");
            this.Show();
        }

    }
}
